(function(t){var e=typeof self=="object"&&self.self===self&&self||typeof global=="object"&&global.global===global&&global;if(typeof define==="function"&&define.amd){define(["underscore","jquery","exports"],function(i,r,n){e.Backbone=t(e,n,i,r)})}else if(typeof exports!=="undefined"){var i=require("underscore"),r;try{r=require("jquery")}catch(n){}t(e,exports,i,r)}else{e.Backbone=t(e,{},e._,e.jQuery||e.Zepto||e.ender||e.$)}})(function(t,e,i,r){var n=t.Backbone;var s=Array.prototype.slice;e.VERSION="1.3.3";e.$=r;e.noConflict=function(){t.Backbone=n;return this};e.emulateHTTP=false;e.emulateJSON=false;var a=function(t,e,r){switch(t){case 1:return function(){return i[e](this[r])};case 2:return function(t){return i[e](this[r],t)};case 3:return function(t,n){return i[e](this[r],o(t,this),n)};case 4:return function(t,n,s){return i[e](this[r],o(t,this),n,s)};default:return function(){var t=s.call(arguments);t.unshift(this[r]);return i[e].apply(i,t)}}};var h=function(t,e,r){i.each(e,function(e,n){if(i[n])t.prototype[n]=a(e,n,r)})};var o=function(t,e){if(i.isFunction(t))return t;if(i.isObject(t)&&!e._isModel(t))return l(t);if(i.isString(t))return function(e){return e.get(t)};return t};var l=function(t){var e=i.matches(t);return function(t){return e(t.attributes)}};var u=e.Events={};var c=/\s+/;var f=function(t,e,r,n,s){var a=0,h;if(r&&typeof r==="object"){if(n!==void 0&&"context"in s&&s.context===void 0)s.context=n;for(h=i.keys(r);athis.length)n=this.length;if(n<0)n+=this.length+1;var s=[];var a=[];var h=[];var o=[];var l={};var u=e.add;var c=e.merge;var f=e.remove;var d=false;var v=this.comparator&&n==null&&e.sort!==false;var g=i.isString(this.comparator)?this.comparator:null;var p,m;for(m=0;m7);this._useHashChange=this._wantsHashChange&&this._hasHashChange;this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.history&&this.history.pushState);this._usePushState=this._wantsPushState&&this._hasPushState;this.fragment=this.getFragment();this.root=("/"+this.root+"/").replace(O,"/");if(this._wantsHashChange&&this._wantsPushState){if(!this._hasPushState&&!this.atRoot()){var e=this.root.slice(0,-1)||"/";this.location.replace(e+"#"+this.getPath());return true}else if(this._hasPushState&&this.atRoot()){this.navigate(this.getHash(),{replace:true})}}if(!this._hasHashChange&&this._wantsHashChange&&!this._usePushState){this.iframe=document.createElement("iframe");this.iframe.src="javascript:0";this.iframe.style.display="none";this.iframe.tabIndex=-1;var r=document.body;var n=r.insertBefore(this.iframe,r.firstChild).contentWindow;n.document.open();n.document.close();n.location.hash="#"+this.fragment}var s=window.addEventListener||function(t,e){return attachEvent("on"+t,e)};if(this._usePushState){s("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){s("hashchange",this.checkUrl,false)}else if(this._wantsHashChange){this._checkUrlInterval=setInterval(this.checkUrl,this.interval)}if(!this.options.silent)return this.loadUrl()},stop:function(){var t=window.removeEventListener||function(t,e){return detachEvent("on"+t,e)};if(this._usePushState){t("popstate",this.checkUrl,false)}else if(this._useHashChange&&!this.iframe){t("hashchange",this.checkUrl,false)}if(this.iframe){document.body.removeChild(this.iframe);this.iframe=null}if(this._checkUrlInterval)clearInterval(this._checkUrlInterval);N.started=false},route:function(t,e){this.handlers.unshift({route:t,callback:e})},checkUrl:function(t){var e=this.getFragment();if(e===this.fragment&&this.iframe){e=this.getHash(this.iframe.contentWindow)}if(e===this.fragment)return false;if(this.iframe)this.navigate(e);this.loadUrl()},loadUrl:function(t){if(!this.matchRoot())return false;t=this.fragment=this.getFragment(t);return i.some(this.handlers,function(e){if(e.route.test(t)){e.callback(t);return true}})},navigate:function(t,e){if(!N.started)return false;if(!e||e===true)e={trigger:!!e};t=this.getFragment(t||"");var i=this.root;if(t===""||t.charAt(0)==="?"){i=i.slice(0,-1)||"/"}var r=i+t;t=this.decodeFragment(t.replace(U,""));if(this.fragment===t)return;this.fragment=t;if(this._usePushState){this.history[e.replace?"replaceState":"pushState"]({},document.title,r)}else if(this._wantsHashChange){this._updateHash(this.location,t,e.replace);if(this.iframe&&t!==this.getHash(this.iframe.contentWindow)){var n=this.iframe.contentWindow;if(!e.replace){n.document.open();n.document.close()}this._updateHash(n.location,t,e.replace)}}else{return this.location.assign(r)}if(e.trigger)return this.loadUrl(t)},_updateHash:function(t,e,i){if(i){var r=t.href.replace(/(javascript:|#).*$/,"");t.replace(r+"#"+e)}else{t.hash="#"+e}}});e.history=new N;var q=function(t,e){var r=this;var n;if(t&&i.has(t,"constructor")){n=t.constructor}else{n=function(){return r.apply(this,arguments)}}i.extend(n,r,e);n.prototype=i.create(r.prototype,t);n.prototype.constructor=n;n.__super__=r.prototype;return n};y.extend=x.extend=$.extend=k.extend=N.extend=q;var F=function(){throw new Error('A "url" property or function must be specified')};var B=function(t,e){var i=e.error;e.error=function(r){if(i)i.call(e.context,t,r,e);t.trigger("error",t,r,e)}};return e}); (function(WP_API_Settings, Backbone, _, window, undefined){ 'use strict'; window.wp=window.wp||{}; wp.ccf=wp.ccf||{}; wp.ccf.api={ models: {}, collections: {}, utils: {}}; if(! Date.prototype.toISOString){ var pad=function(number){ var r=String(number); if(r.length===1){ r='0' + r; } return r; }; Date.prototype.toISOString=function(){ return this.getUTCFullYear() + '-' + pad(this.getUTCMonth() + 1) + '-' + pad(this.getUTCDate()) + 'T' + pad(this.getUTCHours()) + ':' + pad(this.getUTCMinutes()) + ':' + pad(this.getUTCSeconds()) + '.' + String(( this.getUTCMilliseconds() / 1000).toFixed(3)).slice(2, 5) + 'Z'; };} wp.ccf.api.utils.parseISO8601=function(date){ var timestamp, struct, i, k, minutesOffset=0, numericKeys=[ 1, 4, 5, 6, 7, 10, 11 ]; if(( struct=/^(\d{4}|[+\-]\d{6})(?:-(\d{2})(?:-(\d{2}))?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3}))?)?(?:(Z)|([+\-])(\d{2})(?::(\d{2}))?)?)?$/.exec(date))){ for(i=0;(k=numericKeys[i]); ++i){ struct[k]=+struct[k]||0; } struct[2]=( +struct[2]||1) - 1; struct[3]=+struct[3]||1; if(struct[8]!=='Z'&&struct[9]!==undefined){ minutesOffset=struct[10] * 60 + struct[11]; if(struct[9]==='+'){ minutesOffset=0 - minutesOffset; }} timestamp=Date.UTC(struct[1], struct[2], struct[3], struct[4], struct[5] + minutesOffset, struct[6], struct[7]); }else{ timestamp=Date.parse ? Date.parse(date):NaN; } return timestamp; }; var parseable_dates=[ 'date', 'modified', 'date_gmt', 'modified_gmt' ]; var TimeStampedMixin={ toJSON: function(){ var attributes=_.clone(this.attributes); _.each(parseable_dates, function(key){ if(key in attributes){ attributes[key]=attributes[key].toISOString(); }}); return attributes; }, parse: function(response){ _.each(parseable_dates, function(key){ if(!(key in response)){ return; } var timestamp=wp.ccf.api.utils.parseISO8601(response[key]); response[key]=new Date(timestamp); }); if('undefined'!==typeof response.author){ response.author=new wp.ccf.api.models.User(response.author); } return response; }}; var HierarchicalMixin={ parent: function(){ var object, parent=this.get('parent'); if(parent===0){ return null; } var parentModel=this; if('undefined'!==typeof this.parentModel){ parentModel=new this.parentModel(); } if(parentModel.collection){ return parentModel.collection.get(parent); }else{ object=new parentModel.constructor({ id: parent }); object.fetch(); return object; }} }; var BaseModel=Backbone.Model.extend( { sync: function(method, model, options){ options=options||{}; if('undefined'!==typeof WP_API_Settings.nonce){ var beforeSend=options.beforeSend; options.beforeSend=function(xhr){ xhr.setRequestHeader('X-WP-Nonce', WP_API_Settings.nonce); if(beforeSend){ return beforeSend.apply(this, arguments); }};} return Backbone.sync(method, model, options); }} ); wp.ccf.api.models.User=BaseModel.extend( { idAttribute: 'id', urlRoot: WP_API_Settings.root + 'wp/v2/users', defaults: { id: null, avatar_url: {}, capabilities: {}, description: '', email: '', extra_capabilities: {}, first_name: '', last_name: '', link: '', name: '', nickname: '', registered_date: new Date(), roles: [], slug: '', url: '', username: '', _links: {}} } ); wp.ccf.api.models.Taxonomy=BaseModel.extend( { idAttribute: 'slug', urlRoot: WP_API_Settings.root + 'wp/v2/taxonomies', defaults: { name: '', slug: null, description: '', labels: {}, types: [], show_cloud: false, hierarchical: false }} ); wp.ccf.api.models.Term=BaseModel.extend( { idAttribute: 'id', url: function(){ var id=this.get('id'); id=id||''; return WP_API_Settings.root + 'wp/v2/taxonomies/' + this.get('taxonomy') + '/terms/' + id; }, defaults: { id: null, name: '', slug: '', description: '', parent: null, count: 0, link: '', taxonomy: '', _links: {}} } ); wp.ccf.api.models.Post=BaseModel.extend(_.extend( { idAttribute: 'id', urlRoot: WP_API_Settings.root + 'wp/v2/posts', defaults: { id: null, date: new Date(), date_gmt: new Date(), guid: {}, link: '', modified: new Date(), modified_gmt: new Date(), password: '', slug: '', status: 'draft', type: 'post', title: {}, content: {}, author: null, excerpt: {}, featured_image: null, comment_status: 'open', ping_status: 'open', sticky: false, format: 'standard', _links: {}} }, TimeStampedMixin, HierarchicalMixin) ); wp.ccf.api.models.Page=BaseModel.extend(_.extend( { idAttribute: 'id', urlRoot: WP_API_Settings.root + 'wp/v2/pages', defaults: { id: null, date: new Date(), date_gmt: new Date(), guid: {}, link: '', modified: new Date(), modified_gmt: new Date(), password: '', slug: '', status: 'draft', type: 'page', title: {}, content: {}, author: null, excerpt: {}, featured_image: null, comment_status: 'closed', ping_status: 'closed', menu_order: null, template: '', _links: {}} }, TimeStampedMixin, HierarchicalMixin) ); wp.ccf.api.models.Revision=BaseModel.extend(_.extend( { idAttribute: 'id', url: function(){ var id=this.get('id')||''; return WP_API_Settings.root + 'wp/v2/posts/' + id + '/revisions'; }, defaults: { id: null, author: null, date: new Date(), date_gmt: new Date(), guid: {}, modified: new Date(), modified_gmt: new Date(), parent: 0, slug: '', title: {}, content: {}, excerpt: {}, _links: {}} }, TimeStampedMixin, HierarchicalMixin) ); wp.ccf.api.models.Media=BaseModel.extend(_.extend( { idAttribute: 'id', urlRoot: WP_API_Settings.root + 'wp/v2/media', defaults: { id: null, date: new Date(), date_gmt: new Date(), guid: {}, link: '', modified: new Date(), modified_gmt: new Date(), password: '', slug: '', status: 'draft', type: 'attachment', title: {}, author: null, comment_status: 'open', ping_status: 'open', alt_text: '', caption: '', description: '', media_type: '', media_details: {}, post: null, source_url: '', _links: {}}, initialize: function(){ this.parentModel=wp.ccf.api.models.Post; }}, TimeStampedMixin, HierarchicalMixin) ); wp.ccf.api.models.Comment=BaseModel.extend(_.extend( { idAttribute: 'id', defaults: { id: null, author: null, author_email: '', author_ip: '', author_name: '', author_url: '', author_user_agent: '', content: {}, date: new Date(), date_gmt: new Date(), karma: 0, link: '', parent: 0, post: null, status: 'hold', type: '', _links: {}}, url: function(){ var post_id=this.get('post'); post_id=post_id||''; var id=this.get('id'); id=id||''; return WP_API_Settings.root + 'wp/v2/posts/' + post_id + '/comments/' + id; }}, TimeStampedMixin, HierarchicalMixin) ); wp.ccf.api.models.PostType=BaseModel.extend( { idAttribute: 'slug', urlRoot: WP_API_Settings.root + 'wp/v2/posts/types', defaults: { slug: null, name: '', description: '', labels: {}, hierarchical: false }, save: function(){ return false; }, 'delete': function(){ return false; }} ); wp.ccf.api.models.PostStatus=BaseModel.extend( { idAttribute: 'slug', urlRoot: WP_API_Settings.root + 'wp/v2/posts/statuses', defaults: { slug: null, name: '', 'public': true, 'protected': false, 'private': false, queryable: true, show_in_list: true, _links: {}}, save: function(){ return false; }, 'delete': function(){ return false; }} ); var BaseCollection=Backbone.Collection.extend( { initialize: function(){ this.state={ data: {}, currentPage: null, totalPages: null, totalObjects: null };}, sync: function(method, model, options){ options=options||{}; var beforeSend=options.beforeSend, self=this; if('undefined'!==typeof WP_API_Settings.nonce){ options.beforeSend=function(xhr){ xhr.setRequestHeader('X-WP-Nonce', WP_API_Settings.nonce); if(beforeSend){ return beforeSend.apply(self, arguments); }};} if('read'===method){ if(options.data){ self.state.data=_.clone(options.data); delete self.state.data.page; }else{ self.state.data=options.data={};} if('undefined'===typeof options.data.page){ self.state.currentPage=null; self.state.totalPages=null; self.state.totalObjects=null; }else{ self.state.currentPage=options.data.page - 1; } var success=options.success; options.success=function(data, textStatus, request){ self.state.totalPages=parseInt(request.getResponseHeader('x-wp-totalpages'), 10); self.state.totalObjects=parseInt(request.getResponseHeader('x-wp-total'), 10); if(self.state.currentPage===null){ self.state.currentPage=1; }else{ self.state.currentPage++; } if(success){ return success.apply(this, arguments); }};} return Backbone.sync(method, model, options); }, more: function(options){ options=options||{}; options.data=options.data||{}; _.extend(options.data, this.state.data); if('undefined'===typeof options.data.page){ if(! this.hasMore()){ return false; } if(this.state.currentPage===null||this.state.currentPage <=1){ options.data.page=2; }else{ options.data.page=this.state.currentPage + 1; }} return this.fetch(options); }, hasMore: function(){ if(this.state.totalPages===null || this.state.totalObjects===null || this.state.currentPage===null){ return null; }else{ return(this.state.currentPage < this.state.totalPages); }} } ); wp.ccf.api.collections.Posts=BaseCollection.extend( { url: WP_API_Settings.root + 'wp/v2/posts', model: wp.ccf.api.models.Post } ); wp.ccf.api.collections.Pages=BaseCollection.extend( { url: WP_API_Settings.root + 'wp/v2/pages', model: wp.ccf.api.models.Page } ); wp.ccf.api.collections.Users=BaseCollection.extend( { url: WP_API_Settings.root + 'wp/v2/users', model: wp.ccf.api.models.User } ); wp.ccf.api.collections.PostStatuses=BaseCollection.extend( { url: WP_API_Settings.root + 'wp/v2/statuses', model: wp.ccf.api.models.PostStatus, parse: function(response){ var responseArray=[]; for(var property in response){ if(response.hasOwnProperty(property)){ responseArray.push(response[property]); }} return this.constructor.__super__.parse.call(this, responseArray); }} ); wp.ccf.api.collections.MediaLibrary=BaseCollection.extend( { url: WP_API_Settings.root + 'wp/v2/media', model: wp.ccf.api.models.Media } ); wp.ccf.api.collections.Taxonomies=BaseCollection.extend( { model: wp.ccf.api.models.Taxonomy, url: WP_API_Settings.root + 'wp/v2/taxonomies' } ); wp.ccf.api.collections.Comments=BaseCollection.extend( { model: wp.ccf.api.models.Comment, url: WP_API_Settings.root + 'wp/v2/comments' } ); wp.ccf.api.collections.PostTypes=BaseCollection.extend( { model: wp.ccf.api.models.PostType, url: WP_API_Settings.root + 'wp/v2/types', parse: function(response){ var responseArray=[]; for(var property in response){ if(response.hasOwnProperty(property)){ responseArray.push(response[property]); }} return this.constructor.__super__.parse.call(this, responseArray); }} ); wp.ccf.api.collections.Terms=BaseCollection.extend( { model: wp.ccf.api.models.Term, taxonomy: 'category', initialize: function(models, options){ if('undefined'!==typeof options&&options.taxonomy){ this.taxonomy=options.taxonomy; } BaseCollection.prototype.initialize.apply(this, arguments); }, url: function(){ return WP_API_Settings.root + 'wp/v2/terms/' + this.taxonomy; }} ); wp.ccf.api.collections.Revisions=BaseCollection.extend( { model: wp.ccf.api.models.Revision, parent: null, initialize: function(models, options){ BaseCollection.prototype.initialize.apply(this, arguments); if(options&&options.parent){ this.parent=options.parent; }}, url: function(){ return WP_API_Settings.root + 'wp/v2/posts/' + this.parent + '/revisions'; }} ); })(WP_API_Settings, Backbone, _, window,(void 0)); if("undefined"==typeof jQuery)throw new Error("BootstrapValidator requires jQuery");!function(a){var b=a.fn.jquery.split(" ")[0].split(".");if(+b[0]<2&&+b[1]<9||1===+b[0]&&9===+b[1]&&+b[2]<1)throw new Error("BootstrapValidator requires jQuery version 1.9.1 or higher")}(window.jQuery),function(a){var b=function(b,c){this.$form=a(b),this.options=a.extend({},a.fn.bootstrapValidator.DEFAULT_OPTIONS,c),this.$invalidFields=a([]),this.$submitButton=null,this.$hiddenButton=null,this.STATUS_NOT_VALIDATED="NOT_VALIDATED",this.STATUS_VALIDATING="VALIDATING",this.STATUS_INVALID="INVALID",this.STATUS_VALID="VALID";var d=function(){for(var a=3,b=document.createElement("div"),c=b.all||[];b.innerHTML="",c[0];);return a>4?a:!a}(),e=document.createElement("div");this._changeEvent=9!==d&&"oninput"in e?"input":"keyup",this._submitIfValid=null,this._cacheFields={},this._init()};b.prototype={constructor:b,_init:function(){var b=this,c={autoFocus:this.$form.attr("data-bv-autofocus"),container:this.$form.attr("data-bv-container"),events:{formInit:this.$form.attr("data-bv-events-form-init"),formError:this.$form.attr("data-bv-events-form-error"),formSuccess:this.$form.attr("data-bv-events-form-success"),fieldAdded:this.$form.attr("data-bv-events-field-added"),fieldRemoved:this.$form.attr("data-bv-events-field-removed"),fieldInit:this.$form.attr("data-bv-events-field-init"),fieldError:this.$form.attr("data-bv-events-field-error"),fieldSuccess:this.$form.attr("data-bv-events-field-success"),fieldStatus:this.$form.attr("data-bv-events-field-status"),validatorError:this.$form.attr("data-bv-events-validator-error"),validatorSuccess:this.$form.attr("data-bv-events-validator-success")},excluded:this.$form.attr("data-bv-excluded"),feedbackIcons:{valid:this.$form.attr("data-bv-feedbackicons-valid"),invalid:this.$form.attr("data-bv-feedbackicons-invalid"),validating:this.$form.attr("data-bv-feedbackicons-validating")},group:this.$form.attr("data-bv-group"),live:this.$form.attr("data-bv-live"),message:this.$form.attr("data-bv-message"),onError:this.$form.attr("data-bv-onerror"),onSuccess:this.$form.attr("data-bv-onsuccess"),submitButtons:this.$form.attr("data-bv-submitbuttons"),threshold:this.$form.attr("data-bv-threshold"),trigger:this.$form.attr("data-bv-trigger"),verbose:this.$form.attr("data-bv-verbose"),fields:{}};this.$form.attr("novalidate","novalidate").addClass(this.options.elementClass).on("submit.bv",function(a){a.preventDefault(),b.validate()}).on("click.bv",this.options.submitButtons,function(){b.$submitButton=a(this),b._submitIfValid=!0}).find("[name], [data-bv-field]").each(function(){var d=a(this),e=d.attr("name")||d.attr("data-bv-field"),f=b._parseOptions(d);f&&(d.attr("data-bv-field",e),c.fields[e]=a.extend({},f,c.fields[e]))}),this.options=a.extend(!0,this.options,c),this.$hiddenButton=a("